/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.cmp.core.callables;

import com.jme3.app.state.AppState;
import com.jme3.app.state.AppStateManager;
import java.util.concurrent.Callable;

/**
 *
 * @author krummer
 */
public class SwitchStateTask implements Callable {
    private AppState to;
    private AppState from;
    private AppStateManager stateManager;
    
    public SwitchStateTask(AppState from, AppState to, AppStateManager stateManager) {
        this.stateManager = stateManager;
        this.from = from;
        this.to = to;
    }

    public Object call() throws Exception {
        stateManager.detach(this.from);
        stateManager.attach(this.to);
        
        return null;
    }
    
}
